package services;

import java.util.List;

import model.Product;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import dao.IProductDAO;
import dao.ProductDAO;

@Service("productServices")
public class ProductServices implements IProductDAO{

	@Autowired
	ProductDAO productDAO;

	@Override
	public void addProduct(String name, double price, String description,
			String m_id) {
		productDAO.addProduct(name, price, description, m_id);
		
	}

	@Override
	public Product getOneProduct(int id) {
		return productDAO.getOneProduct(id);
	}

	@Override
	public void deleteProduct(String id) {
		productDAO.deleteProduct(id);
	}

	@Override
	public void deleteProductByMID(int id) {
		productDAO.deleteProductByMID(id);
	}

	@Override
	public void updateProduct(String name, double price, String desc, int id,
			String m_id) {
		productDAO.updateProduct(name, price, desc, id, m_id);
	}

	@Override
	public List<Product> getAllProductBy_U_ID(int u_id) {
		return productDAO.getAllProductBy_U_ID(u_id);
	}

	@Override
	public List<Product> getAllProductByPrice(double startPrice, double endPrice) {
		return	productDAO.getAllProductByPrice(startPrice, endPrice);
	}

	@Override
	public List<Product> getAllProductByName(String name) {
	return productDAO.getAllProductByName(name);
	}

	@Override
	public List<Product> getAllProductBy_M_ID(int m_id) {
	return productDAO.getAllProductBy_M_ID(m_id);
	}

	@Override
	public List<Product> getAllProductByCondition(int m_id, String productName,
			int startPrice, int endPrice) {
		return productDAO.getAllProductByCondition(m_id, productName, startPrice, endPrice);
	}

	@Override
	public List<Product> getAllProduct() {
		return productDAO.getAllProduct();
	}

	@Override
	public List<String> getNameProductMatched(String query) {
		return productDAO.getNameProductMatched(query);
	}
	
	
}
